All Questions
47 questions
1vote
2answers
71views
Use sed to insert a character in an xml file
I have an xml file with content following this format: <type:color>000000</type:color> <type:color>FFFFFF</type:color> The information within the tags are hex colors (many ...
-1votes
3answers
129views
sed inline not working to modify XML-style input
the problem is that I cannot put the complete command on a line with SED, I had already done it but with those file it does not work: my exemple : <file>Documents/time/text1</file> //2X ...
3votes
3answers
183views
SED command to delete a forward slash "/" between 2 tags
I am using Linux, and I want to use sed to delete a forward slash (/) between 2 tags. From this: input.xml... <file>/text</file> <file>/text2</file> <file>/text</file&...
4votes
4answers
1kviews
Can I extract complete dates from file with grep command?
I need help using grep to extract a zoned date time from a file on a Linux system. Source file is a XML with the data below: <item start="20231010073000 +0100" stop="20231010100000 +...
2votes
1answer
785views
Insert contents of file into XML attribute
I have a text file called branch.txt: $ cat branch.txt DEMAND_NAME-CR-1234 DEMAND_NAME-CR-8970 Using the above branch name, I have to find and replace some values using a sed command: branch_name=`(...
1vote
4answers
401views
Problems with replacing XML tag contents using sed
I have the following XML piece: <value id="1" creatorId="0" creationTime="1639487132" expirationTime="1639573532">+380554446363</value> <value id=...
0votes
4answers
6kviews
How to extract a portion of an XML tag value in a Bash script
I have a XML file like this (A.xml) : <?xml version="1.0"?> <RunParameters xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-...
4votes
2answers
1kviews
Find XML file with specific path
I'm working with XML files, each of which could be dozens of lines long. There are literally hundreds of these files, all over a directory structure. Yes, it is Magento. I need to find the file that ...
2votes
3answers
1kviews
How can XPath functions be expressed to output each input element?
I'm using this command: xmllint --xpath 'substring-after(string(//item/link), "_")' rss.xml And get the desired output, except it's on the first element. How would I fix this to have it be ...
0votes
3answers
838views
Trying to read XML attributes from multiple files and replacing them with a number 1.25 times greater than they were before
I am trying to write a bash script or something similar, that I can use to modify all occurrences in a bunch of xml files with one click. I have 24 xml files, each containing a few dozen lines and ...
1vote
1answer
734views
Bash script to parse XML color file
I have an XML color file that I want to transform to a Kotlin equivalent. Given this input file colors.xml <?xml version="1.0" encoding="utf-8" standalone="no"?> &...
1vote
2answers
156views
awk: change line to itself parsed with command. Multiline text
I'm trying to answer a question. It involves using the command recode. A specific line has to be parsed by the command leaving the rest untouched. The file is an xml file. Example: <ITEM_ID>...
3votes
2answers
4kviews
Use xmlstarlet to remove an entire element that matches an attribute value?
My question is similar to sed - Delete XML node containing certain element - Unix & Linux Stack Exchange. Trying to implement the suggestions there has kept me busy all day, but I haven't managed ...
1vote
1answer
121views
Awk File processing to get last processed weekday
My application which does processing based on input XML's, processes the input files and adds the status to status_file.txt after processing. I am writing a script to identify the last processed day ...
2votes
3answers
631views
Variables inside heredoc with multiple files
I have a heredoc with xml content, and I add the content of another file like this: bar file: <bar> $baz </bar> the script: bar=$(cat bar.xml) # this would be the ideal, of course it ...